home *** CD-ROM | disk | FTP | other *** search
- package com.sun.xml.parser;
-
- class ContentModelState {
- private ContentModel model;
- private boolean sawOne;
- private ContentModelState next;
-
- ContentModelState(ContentModel var1) {
- this(var1, (ContentModelState)null);
- }
-
- private ContentModelState(Object var1, ContentModelState var2) {
- this.model = (ContentModel)var1;
- this.next = var2;
- this.sawOne = false;
- }
-
- ContentModelState advance(String var1) throws EndOfInputException {
- switch (this.model.type) {
- case '\u0000':
- if (this.model.content == var1) {
- return this.next;
- }
- break;
- case '*':
- case '+':
- if (this.model.first(var1)) {
- this.sawOne = true;
- if (this.model.content instanceof String) {
- return this;
- }
-
- return (new ContentModelState(this.model.content, this)).advance(var1);
- }
-
- if ((this.model.type == '*' || this.sawOne) && this.next != null) {
- return this.next.advance(var1);
- }
- break;
- case ',':
- if (this.model.first(var1)) {
- if (this.model.type == 0) {
- return this.next;
- }
-
- ContentModelState var3;
- if (this.model.next == null) {
- var3 = new ContentModelState(this.model.content, this.next);
- } else {
- var3 = new ContentModelState(this.model.content, this);
- this.model = this.model.next;
- }
-
- return var3.advance(var1);
- }
-
- if (this.model.empty() && this.next != null) {
- return this.next.advance(var1);
- }
- break;
- case '?':
- if (this.model.first(var1)) {
- if (this.model.content instanceof String) {
- return this.next;
- }
-
- return (new ContentModelState(this.model.content, this.next)).advance(var1);
- }
-
- if (this.next != null) {
- return this.next.advance(var1);
- }
- break;
- case '|':
- for(ContentModel var2 = this.model; var2 != null; var2 = var2.next) {
- if (var2.content instanceof String) {
- if (var1 == var2.content) {
- return this.next;
- }
- } else if (((ContentModel)var2.content).first(var1)) {
- return (new ContentModelState(var2.content, this.next)).advance(var1);
- }
- }
-
- if (this.model.empty() && this.next != null) {
- return this.next.advance(var1);
- }
- }
-
- throw new EndOfInputException();
- }
-
- boolean terminate() {
- switch (this.model.type) {
- case '\u0000':
- return false;
- case '*':
- case '?':
- break;
- case '+':
- if (!this.sawOne && !this.model.empty()) {
- return false;
- }
- break;
- case ',':
- ContentModel var1;
- for(var1 = this.model; var1 != null && var1.empty(); var1 = var1.next) {
- }
-
- if (var1 != null) {
- return false;
- }
-
- return this.next == null || this.next.terminate();
- case '|':
- return this.model.empty() && (this.next == null || this.next.terminate());
- default:
- throw new InternalError();
- }
-
- return this.next == null || this.next.terminate();
- }
- }
-